<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery-3.1.1.min.js"></script>
</head>
<body>
<h1>下载测试</h1>
<a href="http://localhost:8900/systemprovidor/file/download?filename=电话簿上传模板.xlsx">下载</a>
<h1>上传解析测试</h1>
<form id="importForm">
    <p>
        <input type="file" name="phonebook" />
    </p>
    <p><button type="button" id="upSureBtn">上传</button> </p>
</form>
<script>
    $(function(){
        $("#upSureBtn").click(function(){
            $.ajax({
                type : 'post' ,
                url : 'http://localhost:8900/systemprovidor/phonebook/importphonebook' ,
                data : new FormData($("#importForm")[0]) ,
                contentType : false , // 不使用默认类型: "application/x-www-form-urlencoded"
                processData : false ,  // 不要把data数据转为String
                success : function(req) {
                    if(200 == req.errorCode) {
                        alert('上传成功')
                    } else {
                        alert('上传失败!')
                    }
                }
            })
        })
    })
</script>
</body>
</html>